#include "abstractlayer.h"

#include "mapwidget.h"

AbstractLayer::AbstractLayer(MapWidget *map) :
    QObject(map),
    m_map(map),
    m_visible(true)
{
}

void AbstractLayer::load(const QString &filename)
{
    Q_UNUSED(filename)
}

void AbstractLayer::zoom(int level)
{
    Q_UNUSED(level)
}

void AbstractLayer::pan(const QPoint &move)
{
    Q_UNUSED(move)
}

void AbstractLayer::triggerAction()
{
}

void AbstractLayer::keyPressed(QKeyEvent *event)
{
    Q_UNUSED(event)
}

void AbstractLayer::paintLayer(QPainter *painter)
{
    if (m_visible) {
        painter->save();
        paint(painter);
        painter->restore();
    }
}

MapWidget *AbstractLayer::map() const
{
    return m_map;
}

bool AbstractLayer::isVisible() const
{
    return m_visible;
}

void AbstractLayer::setVisible(bool visible)
{
    m_visible = visible;
    emit visibilityChanged(m_visible);
}

void AbstractLayer::toggleVisibility()
{
    m_visible = !m_visible;
    emit visibilityChanged(m_visible);
}

